import request from '../utils/request';
import { parse } from 'querystring';
import { REST } from '../utils/Api';

export const getPageQuery = () => parse(window.location.href.split('?')[1]);

export async function accountLogin(params) {
  return request(`${REST}/user/login`, {
    method: 'POST',
    params,
  })
    .then(function (response) {
      console.log(response);
      return response;
    })
    .catch(function (error) {
      console.log(error);
    });
}

export async function loginCompany(params) {
  return request(`${REST}/user/login/company`, {
    method: 'POST',
    params,
  })
    .then(function (response) {
      console.log(response);
      return response;
    })
    .catch(function (error) {
      console.log(error);
    });
}